<!DOCTYPE html>
<html lang="zh-CN">
    <head>
        <meta charset="UTF-8" />
        <title>07_offset系列的说明</title>

        <style>
            .outer {
                position: relative;
                width: 500px;
                height: 500px;
                background-color: red;
            }

            .inner {
                position: absolute;
                left: 0;
                top: 0;
                width: 300px;
                height: 300px;
                background-color: green;
            }
        </style>
    </head>
    <body>
        <div class="outer">
            <div class="inner"></div>
        </div>

        <script>
            var inner = document.querySelector('.inner');

            console.log(inner.offsetWidth);
            console.log(inner.offsetHeight);

            console.log(inner.offsetLeft);
            console.log(inner.offsetTop);
        </script>
    </body>
</html>